package com.web3.management.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;

/**
 * 脚本版本管理实体类
 * 用于管理基础脚本的版本信息和文件
 *
 * @author Web3 Management Team
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "script_versions")
public class ScriptVersion extends BaseEntity {

    @Column(name = "script_name", nullable = false, length = 100)
    private String scriptName;

    @Column(name = "version", nullable = false, length = 50)
    private String version;

    @Column(name = "file_path", nullable = false, length = 255)
    private String filePath;

    @Column(name = "file_size", nullable = false)
    private Long fileSize;

    @Column(name = "md5_hash", nullable = false, length = 32)
    private String md5Hash;

    @Column(name = "description", columnDefinition = "TEXT")
    private String description;

    @Column(name = "is_active", nullable = false)
    private Boolean isActive = false;

    @Table(uniqueConstraints = {
        @UniqueConstraint(columnNames = {"script_name", "version"})
    })
    public static class TableConstraints {}
}